interface ResponseDataMap<V> {
  '200': V;
  '1001': {
    errors: string;
  };
  '402': {
    errors: string;
  };
  '403': {
    errors: string;
  };
}

type ResponseType<V> = {
  [T in keyof ResponseDataMap<V>]: {
    code: T;
    msg: string;
    data: ResponseDataMap<V>[T];
  }
}[keyof ResponseDataMap<V>];

export type Response<V> = ResponseType<V>

// 通用响应接口（泛型版本）
export interface Res<T = any> {
  code: string
  msg: string
  timestamp: number
  data: T
  ok: boolean
}

// 兼容性：保留原有的固定 null 类型版本
export interface ResNull {
  code: string
  msg: string
  timestamp: number
  data: null
  ok: boolean
}